package com.dong.abstractFactoryMode.service.factory.impl;

import com.dong.abstractFactoryMode.prepare.EGM;
import com.dong.abstractFactoryMode.service.factory.ICacheAdapter;

import java.util.concurrent.TimeUnit;

/**
 * @author DongJiaQi
 * @create 2022/12/20 14:01
 * @Description:
 */
public class EGMCacheAdapterImpl implements ICacheAdapter {
    private EGM egm = new EGM();
    @Override
    public String get(String key) {
        return egm.gain(key);
    }

    @Override
    public void set(String key, String value) {
        egm.set(key, value);
    }

    @Override
    public void set(String key, String value, long timeout, TimeUnit timeUnit) {
        egm.setEx(key,value,timeout,timeUnit);
    }

    @Override
    public void del(String key) {
        egm.delete(key);
    }
}
